# 时间线

from pyecharts.charts import Bar,Timeline
from pyecharts.options import *
from pyecharts.globals import ThemeType

bar1=Bar()
bar1.add_xaxis(["中国","美国","英国"])
bar1.add_yaxis("GDP",[5,60,20],label_opts=LabelOpts(position="right"))
bar1.reversal_axis()

bar2=Bar()
bar2.add_xaxis(["中国","美国","英国"])
bar2.add_yaxis("GDP",[15,70,25],label_opts=LabelOpts(position="right"))
bar2.reversal_axis()

bar3=Bar()
bar3.add_xaxis(["中国","美国","英国"])
bar3.add_yaxis("GDP",[45,80,28],label_opts=LabelOpts(position="right"))
bar3.reversal_axis()

timeline=Timeline({"theme":ThemeType.LIGHT})
timeline.add(bar1,"2000")
timeline.add(bar2,"2010")
timeline.add(bar3,"2020")

timeline.add_schema(
    play_interval=1000,
    is_auto_play=True,
    is_timeline_show=True,
    is_loop_play=True
)


timeline.render("../output/basic_timeline.html")